package com.platform.entity;

import java.io.Serializable;
import java.util.Date;


/**
 * 会员实体
 *
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2017-08-16 15:02:28
 */
public class UserEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    //主键
    private Integer id;
    //会员名称
    private String username;
    //会员密码
    private String password;
    //值为1时是男性，值为2时是女性，值为0时是未知
    private Integer gender;
    //出生日期
    private Date birthday;
    //注册时间
    private Date registerTime;
    //最后登录时间
    private Date lastLoginTime;
    //最后登录Ip
    private String lastLoginIp;
    //会员等级
    private Integer userLevelId;
    //微信名
    private String nickname;
    //手机号码
    private String mobile;
    //注册Ip
    private String registerIp;
    //头像
    private String avatar;
    //微信Id
    private String weixinOpenid;

    /**
     * 翻译用的字段
     */
    //会员级别
    private String levelName;

    private String weixinUnionid;
    
    private Float unPayFee;//未提金额
    
    private Float payedFee;
    
    private Float allPayFee;
    
    private Float balance; //余额 
    
    private Integer integration; //当前积分

    private Integer allIntegration;  //历史累计积分（包含兑换的）

    private Float monthPayFee;//当月提成
    
    private Float lastMonthPayFee;//上月提成
    
    private Integer parentId;
    
    private Float deposit; //押金
    /**
     * 设置：主键
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * 获取：主键
     */
    public Integer getId() {
        return id;
    }

    /**
     * 设置：会员名称
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * 获取：会员名称
     */
    public String getUsername() {
    	if(username == null)
    		return "访客";
        return username;
    }

    /**
     * 设置：会员密码
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * 获取：会员密码
     */
    public String getPassword() {
        return password;
    }

    /**
     * 设置：性别 值为1时是男性，值为2时是女性，值为0时是未知
     */
    public void setGender(Integer gender) {
        this.gender = gender;
    }

    /**
     * 获取：性别 值为1时是男性，值为2时是女性，值为0时是未知
     */
    public Integer getGender() {
        return gender;
    }

    /**
     * 设置：出生日期
     */
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    /**
     * 获取：出生日期
     */
    public Date getBirthday() {
        return birthday;
    }

    /**
     * 设置：注册时间
     */
    public void setRegisterTime(Date registerTime) {
        this.registerTime = registerTime;
    }

    /**
     * 获取：注册时间
     */
    public Date getRegisterTime() {
        return registerTime;
    }

    /**
     * 设置：最后登录时间
     */
    public void setLastLoginTime(Date lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    /**
     * 获取：最后登录时间
     */
    public Date getLastLoginTime() {
        return lastLoginTime;
    }

    /**
     * 设置：最后登录Ip
     */
    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp = lastLoginIp;
    }

    /**
     * 获取：最后登录Ip
     */
    public String getLastLoginIp() {
        return lastLoginIp;
    }

    /**
     * 设置：会员等级
     */
    public void setUserLevelId(Integer userLevelId) {
        this.userLevelId = userLevelId;
    }

    /**
     * 获取：会员等级
     */
    public Integer getUserLevelId() {
        return userLevelId;
    }

    /**
     * 设置：别名
     */
    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    /**
     * 获取：别名
     */
    public String getNickname() {
        return nickname;
    }

    /**
     * 设置：手机号码
     */
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    /**
     * 获取：手机号码
     */
    public String getMobile() {
        return mobile;
    }

    /**
     * 设置：注册Ip
     */
    public void setRegisterIp(String registerIp) {
        this.registerIp = registerIp;
    }

    /**
     * 获取：注册Ip
     */
    public String getRegisterIp() {
        return registerIp;
    }

    /**
     * 设置：化名
     */
    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    /**
     * 获取：化名
     */
    public String getAvatar() {
        return avatar;
    }

    /**
     * 设置：微信Id
     */
    public void setWeixinOpenid(String weixinOpenid) {
        this.weixinOpenid = weixinOpenid;
    }

    /**
     * 获取：微信Id
     */
    public String getWeixinOpenid() {
        return weixinOpenid;
    }

    public String getLevelName() {
    	if(levelName == null) {
    		switch(userLevelId) {
	    		case 0:
	    			levelName = "访客";
	    			break;
	    		case 1:
	    			levelName = "会员";
	    			break;
	    		case 2:
	    			levelName = "代理";
	    			break;
	    		case 3:
	    			levelName = "总代";
	    			break;
    		}
    	}
        return levelName;
    }

    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }


	public String getWeixinUnionid() {
		return weixinUnionid;
	}

	public void setWeixinUnionid(String weixinUnionid) {
		this.weixinUnionid = weixinUnionid;
	}

	public Float getUnPayFee() {
		if(this.unPayFee == null) {
			this.unPayFee = 0f;
		}
		return unPayFee;
	}

	public void setUnPayFee(Float unPayFee) {
		this.unPayFee = unPayFee;
	}

	public Float getPayedFee() {
		if(this.payedFee == null) {
			this.payedFee = 0f;
		}
		return payedFee;
	}

	public void setPayedFee(Float payedFee) {
		this.payedFee = payedFee;
	}

	public Float getAllPayFee() {
		if(this.allPayFee == null) {
			this.allPayFee = 0f;
		}
		return allPayFee;
	}

	public void setAllPayFee(Float allPayFee) {
		this.allPayFee = allPayFee;
	}

	public Float getBalance() {
		if(balance == null)
			balance = 0f;
		return balance;
	}

	public void setBalance(Float balance) {
		this.balance = balance;
	}

	public Integer getIntegration() {
		if(integration == null)
			integration = 0;
		return integration;
	}

	public void setIntegration(Integer integration) {
		this.integration = integration;
	}

	public Integer getAllIntegration() {
		if(allIntegration == null)
			allIntegration = 0;
		return allIntegration;
	}

	public void setAllIntegration(Integer allIntegration) {
		this.allIntegration = allIntegration;
	}

	public Float getMonthPayFee() {
		if(monthPayFee == null)
			monthPayFee = 0f;
		return monthPayFee;
	}

	public void setMonthPayFee(Float monthPayFee) {
		this.monthPayFee = monthPayFee;
	}

	public Float getLastMonthPayFee() {
		if(lastMonthPayFee == null)
			lastMonthPayFee = 0f;
		return lastMonthPayFee;
	}

	public void setLastMonthPayFee(Float lastMonthPayFee) {
		this.lastMonthPayFee = lastMonthPayFee;
	}

	public Integer getParentId() {
		if(parentId == null) {
			parentId = 0;
		}
		return parentId;
	}

	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}
    public void addBalance(Float addBalance) {
    	this.balance = getBalance() + addBalance;
    }

	public Float getDeposit() {
		if(deposit == null)
			deposit = 0f;
		return deposit;
	}

	public void setDeposit(Float deposit) {
		this.deposit = deposit;
	}
    public void addDeposit(Float addBalance) {
    	this.deposit = getDeposit() + deposit;
    }
}
